<?php

namespace app\controller;

use app\BaseController;
use app\Request;
use app\model\Menu as MenuModel;
class Menu extends BaseController
{

    public function index(Request $request)
    {

        $model = new MenuModel();
        try {
          $user =  session('user');
            $data = [];
            //是超级管理员并且状态正常
          if($user['id'] == 6 && $user['state'] == 1){
              $data =  $model->nestedCategories();
          }else{
              //状态正常 不是超级管理员

              $data =  $model->nestedUser();
          }

          return show(1,$data);
        } catch (\Exception $e) {
          return  show(0,$e->getMessage());
        }

    }

}